package com.gengealogy.net.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.gengealogy.net.po.Report;
import com.gengealogy.net.service.ReportService;
import com.gengealogy.net.service.UserService;

@Controller
public class ReportController {

	@Autowired
	private ReportService reportService;

	public ReportService getReportService() {
		return reportService;
	}
	public void setReportService(ReportService reportService) {
		this.reportService = reportService;
	}
	
	/**
	 * 向审核举报页面跳转
	 */
	@RequestMapping(value = "/admin/findReport.action")
	public String findReport(Model model) {
		List<Report> report=reportService.findReport();
		if(report==null) {
			model.addAttribute("msg", "没有需要审核的举报！");
			return "admin/admin_report";
		}else {
			model.addAttribute("report", report);
			return "admin/admin_report";
		}
	}
	
	/**
	 * 向提交审核结果
	 */
	@RequestMapping(value = "/admin/updateReport.action",method = RequestMethod.GET)
	public String updateReport(int report_state,int report_id,Model model) {
		reportService.updateReport(report_state,report_id);
		return "redirect:/admin/findReport.action";
	}	

}
